package com.ihr360.payroll.service.staff;


import com.ihr360.common.DateRange;
import com.ihr360.commons.vo.ResultInfo;
import com.ihr360.entity.StaffBankSalaryEntity;
import com.ihr360.excel.vo.ImportRequest;
import com.ihr360.payroll.calc.StaffSalaryCalcPeriod;
import com.ihr360.payroll.entity.staff.StaffSalaryEntity;
import com.ihr360.payroll.entity.staff.StaffSalaryProfileEntity;
import com.ihr360.payroll.model.dto.staff.StaffSalaryProfile;
import com.ihr360.payroll.request.StaffPayrollInfoRequest;
import com.ihr360.payroll.request.StaffPayrollInfosRequest;
import com.ihr360.payroll.request.StaffSalaryProfileSearchBody;
import com.ihr360.payroll.response.StaffPayrollInfoResponse;
import com.ihr360.rest.service.SimpleRestService;

import javax.servlet.ServletOutputStream;
import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface StaffPayrollInfoService extends SimpleRestService<StaffSalaryProfile, String> {

    /**
     * 获取员工某个时间范围内的薪资数据信息.时间范围内存在多条时，按时间顺序范围
     *
     * @param staffIds
     * @param dateRange
     * @return
     */
    Map<String, StaffSalaryCalcPeriod> getPeriodSalaryProfileOfStaffs(String companyId, Collection<String> staffIds, DateRange dateRange);

    /**
     * 调整员工薪资档案薪资项数据
     *
     * @param param
     * @return
     */
    Boolean adjustSalaryProfileWrapper(StaffPayrollInfosRequest param);

    /**
     * 调整员工薪资档案薪资项数据
     *
     * @param param
     * @return
     */
    Boolean adjustSalaryProfileWrapperNoValid(List<String> staffIds, StaffPayrollInfosRequest param);


    /**
     * 异动调整员工薪资档案薪资项数据
     *
     * @param param
     * @return
     */
    ResultInfo abnormalityAdjustProfileWrapper(StaffPayrollInfoRequest param);

    /**
     * 获取当前生效薪资档案数据
     *
     * @param pageable
     * @return
     */
    StaffPayrollInfoResponse getCurrentEffectiveData(List<String> staffIds, StaffSalaryProfileSearchBody pageable);

    /**
     * 获取当前生效薪资档案（生效日）之后的薪资档案
     *
     * @param staffIds
     * @return
     */
    List<StaffSalaryProfileEntity> getAfterCurrentDatas(List<String> staffIds);


    /**
     * 获取某员工的所有记录
     *
     * @param staffId
     * @return
     */
    List<StaffSalaryProfileEntity> getStaffPayrollInfos(List<String> staffIds);

    /**
     * 获取薪资转正数据已进行迁移的员工id
     *
     * @param companyId
     * @return
     */
    List<String> probationReviewStaffIdsFromIrs(String companyId);

    List<String> getStaffIdsForExistsSalaryProfile(String companyId);

    void save(List<String> staffIds, List<StaffSalaryProfileEntity> toSave);

    List<StaffSalaryProfileEntity> getStaffPayrollInfos(List<String> staffIds, String companyId);

    List<StaffSalaryProfileEntity> getSomeStaffsPayrollInfos(List<String> staffIds);


    /**
     * 查询员工银行卡及工资信息
     *
     * @param companyId
     * @param staffId
     * @return
     */
    StaffSalaryEntity getStaffSalaryInfo(List<String> staffIds,String companyId);

    /**
     * 保存员工薪资信息
     */
    void saveStaffSalaryInfo(List<String> staffIds,StaffSalaryEntity entity);

    /**
     * 批量保存员工银行卡等信息
     */
    void saveAllStaffSalaryInfo(List<String> staffIds,String companyId, List<StaffBankSalaryEntity> staffBankSalaryEntityList);

    /**
     * 下载员工薪资导入模板
     *
     * @param outputStream
     */
    void downloadTemplate(ServletOutputStream outputStream);

    /**
     * 导入员工薪资
     *
     * @param importRequest
     * @return
     */
    void importSalaryProfile(ImportRequest importRequest);

}
